<template>
  <div>
      <p>学生详情：<input type="text" v-model="desc"></p>
      <p><input type="button" value="修改" @click="addgood()"></p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            desc:'',
            url:'http://127.0.0.1:8000',
            id:this.$route.params.id,
        }
    },
    methods:{
        addgood(){
            let form_data = new FormData()
            form_data.append('id',this.id)
            form_data.append('desc',this.desc)
            axios({
                url:'http://127.0.0.1:8000/app03/stu_put/',
                method:'put',
                data:form_data
            }).then(res=>{
                console.log(res.data)
            })
        },
        showpeople(){
            axios({
                url:'http://127.0.0.1:8000/app03/get/',
                params:{'id':this.id}
            }).then(res=>{
                
                this.desc = res.data.desc.stu_desc
                console.log(res.data)
            })
        },

    },
    created(){
        this.showpeople()
    }

}
</script>

<style>

</style>